
# This is a Makefile which compiles source files

CC = gcc

#HOME_NP=/home/pshetty/np-cse533/
#HOME_NP=/home/prad/Personal/SUNYSB/np-cse533/
#HOME_UNP=$(HOME_NP)/unpv13e

HOME_UNP=/home/users/cse533/Stevens/unpv13e
#HOME_UNP=/home/keshava/Documents/unpv13e

UNPLIB=$(HOME_UNP)/lib
LIBS = -lresolv -lnsl -lpthread $(HOME_UNP)/libunp.a\
	
FLAGS = -g

CFLAGS = ${FLAGS} -I$(UNPLIB)

all: tour arp

tour: tour.o tour_util.o hw.o readline.o arp_util.o 
	${CC} ${FLAGS} -o tour_spopuri tour.o tour_util.o hw.o readline.o arp_util.o ${LIBS}

arp: arp.o arp_util.o	
	${CC} ${FLAGS} -o arp_spopuri arp.o hw.o readline.o arp_util.o ${LIBS}

tour.o: tour.c tour.h
	${CC} ${CFLAGS} -c tour.c -o tour.o

tour_util.o: tour_util.c tour.h
	${CC} ${CFLAGS} -c tour_util.c -o tour_util.o

hw.o: hw.c hw.h
	${CC} ${CFLAGS} -c hw.c -o hw.o

arp.o: arp.c arp.h
	${CC} ${CFLAGS} -c arp.c -o arp.o

arp_util.o: arp_util.c arp.h
	${CC} ${CFLAGS} -c arp_util.c -o arp_util.o

# pick up the thread-safe version of readline.c from directory "threads"
readline.o: $(HOME_UNP)/threads/readline.c
	${CC} ${CFLAGS} -c $(HOME_UNP)/threads/readline.c -o readline.o

clean:
	rm tour_spopuri arp_spopuri tour.o tour_util.o hw.o readline.o arp.o arp_util.o

